import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';

part 'paging_data.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class PagingDataModel<T> {
  int? current;
  int? pages;
  List<T>? data;
  int? size;
  int? total;

  PagingDataModel();

  factory PagingDataModel.fromJson(Map<String, dynamic> json, T Function(Object? json) fromJsonT) =>
      _$PagingDataModelFromJson(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$PagingDataModelToJson(this, toJsonT);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
